//
//  UICollectionView+CJLongPressMove.h
//  TSListDemo
//
//  Created by ciyouzen on 2020/3/26.
//  Copyright © 2020 dvlproad. All rights reserved.
//
//  为列表添加长按手势，利用手势的开始、变化、结束实现拖动

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UICollectionView (CJLongPressMove) {
    
}
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *cjMoveGestureRecognizer;    /** 移动手势   */

#pragma mark - Event
/*
*  移除长按拖动手势
*/
- (void)cj_removeLongPressMoveGR;

/*
*  为列表添加长按手势，利用手势的开始、变化、结束实现拖动
*
*   @param minimumPressDuration 手势相应的最短按住时长(比如已经是抖动了，就可以设置为短一点)
*/
- (void)cj_addLongPressMoveGR:(NSTimeInterval)minimumPressDuration;

/*
*  设置拖动手势Move各个过程的回调等
*
*  @param checkSectionMoveEnableBlock   设置允许哪些section中的哪些item进行拖动操作，未设置则默认都允许
*  @param checkCellMoveEnableBlock      检查是否允许跨secton操作，未设置则默认允许
*  @param cellMoveCompleteBlock         移动结束的回调
*/
- (void)cj_setupCheckSectionMoveEnableBlock:(BOOL (^ __nullable)(NSIndexPath *indexPath))checkSectionMoveEnableBlock
                   checkCellMoveEnableBlock:(BOOL (^ __nullable)(NSInteger fromSection, NSInteger toSection))checkCellMoveEnableBlock
                      cellMoveCompleteBlock:(void(^ __nullable)(NSIndexPath *sourceIndexPath, NSIndexPath *destinationIndexPath))cellMoveCompleteBlock;

@end

NS_ASSUME_NONNULL_END
